home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / GMSV03B.lha / GamesMaster / Source / E / ScreenDemos / Reposition.e < prev    next >
Encoding:
Text File  |  1996-09-11  |  2.4 KB  |  74 lines

  1. /* Reposition 320
  2. ** --------------
  3. ** This example has a mobile 320x256 screen, which is attached to the joystick.
  4. ** Notice that if you move the screen to extreme values, the display will NOT
  5. ** like it.  The lack of checking is for speed - if you want limits, it's up
  6. ** to you to check for them.
  7. **
  8. ** To exit the example, press fire. 
  9. */
  10.  
  11. MODULE 'games','games/games'
  12.  
  13. PROC main()
  14.    DEF screen:PTR TO gamescreen, palette:PTR TO INT, joy:LONG,
  15.        loadpic:PTR TO picture
  16.  
  17.    palette := [    $0000,$0130,$0FCB,$0FA9,$0D88,$0965,$0644,$0211,
  18.         $0400,$0444,$0FF0,$0432,$0CC0,$0150,$0501,$0880,
  19.         $0261,$0271,$0382,$0492,$05A3,$05B4,$0677,$06C4,
  20.         $0788,$09AA,$0BCC,$0801,$0901,$0A02,$0701,$0601
  21.           ]:INT;
  22.  
  23.    screen :=  [    GSV1,0,
  24.         0,0,0,           -> Screen_Mem1/2/3
  25.         0,               -> Screen link.
  26.         palette,         -> Address of palette.
  27.         0,               -> Address of rasterlist.
  28.         32,              -> Amt of colours in palette.
  29.         320,256,320,256, -> Screen & Pic Height/Width.
  30.         5,               -> Amt of planes.
  31.         0,0,             -> Top of screen offsets, X/Y
  32.         0,0,             -> X/Y counters (for scrolling).
  33.         0,               -> Special attributes.
  34.         LORES,           -> Screen mode.
  35.         INTERLEAVED,     -> Screen type
  36.         0                -> Reserved area.               
  37.           ]:gamescreen;
  38.  
  39.    loadpic := [    PCV1,0,             -> Version header.
  40.         0,                  -> Destination.
  41.         320,256,            -> Width, Height.
  42.         5,                  -> Amount of Planes.
  43.         32,                 -> Amount of colours.
  44.         palette,            -> Palette (remap).
  45.         LORES,              -> Screen mode.
  46.         INTERLEAVED,        -> Destination.
  47.         0                   -> Parameters.
  48.               ]:picture;
  49.  
  50.    IF gmsbase := OpenLibrary('games.library',0)
  51.       SetUserPri()
  52.       IF (Add_Screen(screen) = ERR_OK)
  53.          loadpic.data := screen.memptr1;
  54.          IF (LoadPic('GAMESLIB:data/IFF.Pic320',loadpic) = ERR_OK)
  55.             Show_Screen(screen)
  56.  
  57.         REPEAT
  58.           joy := Read_JoyPort(JPORT2,JT_SWITCH)
  59.           IF (joy AND JS_RIGHT) THEN screen.scrxoffset := screen.scrxoffset+1
  60.           IF (joy AND JS_LEFT) THEN screen.scrxoffset := screen.scrxoffset-1
  61.           IF (joy AND JS_UP) THEN screen.scryoffset := screen.scryoffset-1
  62.           IF (joy AND JS_DOWN) THEN screen.scryoffset := screen.scryoffset+1
  63.           Wait_OSVBL()
  64.           Remake_Screen(screen)
  65.         UNTIL !(joy AND JS_FIRE1)
  66.  
  67.          ENDIF
  68.     Delete_Screen(screen)        
  69.       ENDIF
  70.    CloseLibrary(gmsbase)
  71.    ENDIF
  72. ENDPROC
  73.  
  74.